package com.iptv.live.controller;

import javax.servlet.http.HttpServletResponse;

import com.iptv.common.utils.poi.ExcelUtil;
import com.iptv.live.domain.LiveTypeTable2;
import com.iptv.live.service.ILiveTypeTable2Service;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iptv.common.annotation.Log;
import com.iptv.common.core.controller.BaseController;
import com.iptv.common.core.domain.AjaxResult;
import com.iptv.common.enums.BusinessType;
import com.iptv.common.core.page.TableDataInfo;

import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author Cinzia
 * @date 2025-01-03
 */
@RestController
@RequestMapping("/live-type2")
public class LiveTypeTable2Controller extends BaseController
{
    @Autowired
    private ILiveTypeTable2Service liveTypeTable2Service;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:table2:list')")
    @GetMapping("/list")
    public TableDataInfo list(LiveTypeTable2 liveTypeTable2)
    {
        startPage();
        List<LiveTypeTable2> list = liveTypeTable2Service.selectLiveTypeTable2List(liveTypeTable2);
        return getDataTable(list);
    }

//    /**
//     * 导出【请填写功能名称】列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:table2:export')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, LiveTypeTable2 liveTypeTable2)
//    {
//        List<LiveTypeTable2> list = liveTypeTable2Service.selectLiveTypeTable2List(liveTypeTable2);
//        ExcelUtil<LiveTypeTable2> util = new ExcelUtil<LiveTypeTable2>(LiveTypeTable2.class);
//        util.exportExcel(response, list, "【请填写功能名称】数据");
//    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:table2:query')")
    @GetMapping(value = "/{typeId}")
    public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
    {
        return success(liveTypeTable2Service.selectLiveTypeTable2ByTypeId(typeId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:table2:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiveTypeTable2 liveTypeTable2)
    {
        return toAjax(liveTypeTable2Service.insertLiveTypeTable2(liveTypeTable2));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:table2:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiveTypeTable2 liveTypeTable2)
    {
        return toAjax(liveTypeTable2Service.updateLiveTypeTable2(liveTypeTable2));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:table2:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{typeIds}")
    public AjaxResult remove(@PathVariable Long[] typeIds)
    {
        return toAjax(liveTypeTable2Service.deleteLiveTypeTable2ByTypeIds(typeIds));
    }
}
